SetGfxDriver 1:Graphics 1024,768,8,2:SeedRnd MilliSecs() :SetBuffer FrontBuffer() 
Global gmode,dump1,in1,in2,in3,in9,ztx,sort1,zy1,unittestcnt,zzz1,null1,facts,factz,facts2,factz2,facts3,factz3,facts4,factz4,infacts4,infactz4,modfacts1,z,modfacts2,testinfacts1,testinfacts2,refactorfrom,refactorto,refactorrule,refactorruleold,yy
in1 = CreateBank(20000):in2 = CreateBank(20000):in3 = CreateBank(20000):in9 = CreateBank(20000):sort1 = CreateBank(60):facts=CreateBank(125):factz=CreateBank(125):factz2=CreateBank(125):facts2=CreateBank(125):factz3=CreateBank(125):facts3=CreateBank(125):factz4=CreateBank(125):facts4=CreateBank(125):infactz4=CreateBank(125):infacts4=CreateBank(125)
modfacts1=CreateBank(125):modfacts2=CreateBank(125):testinfacts1=CreateBank(125):testinfacts2=CreateBank(125):refactorfrom=CreateBank(125):refactorto=CreateBank(125)
dump1 = CreateBank(250)
Dim decode(1000000):Dim aaa(60):Dim bbb(10,10)
Dim encode(1000000)
decodet()
Dim zzz(10000)
Dim err(10000)
;Include "gui.bb"



While Not KeyHit(1) 
ClsColor 0,0,0
Cls
randnum()

getnums()

Color 255,255,0:Text 680,15,ztx,False ,False
CopyBank in1,0,in2,0,20000
morf1()

CopyBank in2,0,in3,0,20000
demorf1()

For i=0 To zzz1
If i*10 > 1000 Then dy=Int(i*10/1000)
	Color 255,255,0:Text (i*10) Mod 1000,300+dy*15,Str(zzz(i))+",",False ,False 
Next
Flip
;WaitMouse() 
VWait 
Wend 

Function dumpbank()
For bb=0 To 125
bb1=PeekInt(in1,bb*5)
dx1 = Int(Floor(bb1/256))
dx2 = bb1-dx1*256
PokeByte dump1,bb*2,dx1
PokeByte dump1,bb*2+1,dx2
Next
fileBank=WriteFile("c:\test1.bnk") 
WriteBytes dump1,fileBank,0,250 
CloseFile fileBank 
FreeBank bnkTest 

For bb=0 To 125
bb1=PeekInt(in3,bb*5)
dx1 = Int(Floor(bb1/256))
dx2 = bb1-dx1*256
PokeByte dump1,bb*2,dx1
PokeByte dump1,bb*2+1,dx2
Next
fileBank=WriteFile("c:\test2.bnk") 
WriteBytes dump1,fileBank,0,250 
CloseFile fileBank 
FreeBank bnkTest 
End Function

Function testinfacts(ztl)
	For y=0 To 4
	For x=0 To 4
	PokeInt sort1,x*5,PeekInt(infactz4,25*y+(x*5))
	Next
        sortrow()
	For x=0 To 4
	PokeInt infactz4,5*(y*5+x),PeekByte (sort1,5*x)
	Next
	ttt = Int(""+ PeekByte (sort1,0*5) +""+PeekByte (sort1,1*5) +""+PeekByte (sort1,2*5)+""+PeekByte (sort1,3*5)+""+PeekByte (sort1,4*5))
	xx = encode(ttt*5)
	PokeInt infactz4,y*5,xx	
	Color 0,0,255:Text 120,y*9+470,xx,False ,False 	
	Next

	For y=0 To 4
	PokeInt sort1,y*5,PeekInt(infactz4,5*y)
	Next
        sortrow()
	For x=0 To 4
	PokeInt infactz4,y*5,PeekByte (sort1,5*y)
	Next

	ttt = Int(""+ PeekByte (sort1,0*5) +""+PeekByte (sort1,1*5) +""+PeekByte (sort1,2*5)+""+PeekByte (sort1,3*5)+""+PeekByte (sort1,4*5))
	xx = encode(ttt*5)
	PokeInt infactz4,y*5,xx:zy1=xx:	If (ztl=xx) null1=null1+1:zzz(zzz1)=zzz(zzz1)+1;:dumpbank():WaitMouse()

	Color 255,255,255:Text 90,y*9+463,xx,False ,False 	

End Function

Function getinfacts3()
	For y=0 To 4
	For x=0 To 4
	PokeInt sort1,x*5,PeekInt(in3,5*(y*5+x))
	Next
        sortrow()
	For x=0 To 4
	PokeInt infacts4,5*(y*5+x),PeekByte (sort1,5*x)
	Next
	ttt = Int(""+ PeekByte (sort1,0*5) +""+PeekByte (sort1,1*5) +""+PeekByte (sort1,2*5)+""+PeekByte (sort1,3*5)+""+PeekByte (sort1,4*5))
	xx = encode(ttt*5)
	PokeInt infactz4,y*5,xx	
;	Color 255,255,0:Text 60,y*9+410,xx,False ,False 	
	Next
	
	For y=0 To 4
	For x=0 To 4
	PokeInt sort1,x*5,PeekInt(in3,25*5+5*(y*5+x))
	Next
        sortrow()
	For x=0 To 4
	PokeInt infacts4,5*(y*5+x),PeekByte (sort1,5*x)
	Next
	ttt = Int(""+ PeekByte (sort1,0*5) +""+PeekByte (sort1,1*5) +""+PeekByte (sort1,2*5)+""+PeekByte (sort1,3*5)+""+PeekByte (sort1,4*5))
	xx = encode(ttt*5)
	PokeInt infactz4,25+y*5,xx	
;	Color 255,255,0:Text 380,y*9+410,xx,False ,False 	
	Next

	
	For y=0 To 4
	For x=0 To 4
	PokeInt sort1,x*5,PeekInt(in3,50*5+5*(y*5+x))
	Next
        sortrow()
	For x=0 To 4
	PokeInt infacts4,5*(y*5+x),PeekByte (sort1,5*x)
	Next
	ttt = Int(""+ PeekByte (sort1,0*5) +""+PeekByte (sort1,1*5) +""+PeekByte (sort1,2*5)+""+PeekByte (sort1,3*5)+""+PeekByte (sort1,4*5))
	xx = encode(ttt*5)
	PokeInt infactz4,50+y*5,xx	
;	Color 255,255,0:Text 60,y*9+530,xx,False ,False 	
	Next
	
	For y=0 To 4
	For x=0 To 4
	PokeInt sort1,x*5,PeekInt(in3,75*5+5*(y*5+x))
	Next
        sortrow()
	For x=0 To 4
	PokeInt infacts4,5*(y*5+x),PeekByte (sort1,5*x)
	Next
	ttt = Int(""+ PeekByte (sort1,0*5) +""+PeekByte (sort1,1*5) +""+PeekByte (sort1,2*5)+""+PeekByte (sort1,3*5)+""+PeekByte (sort1,4*5))
	xx = encode(ttt*5)
	PokeInt infactz4,75+y*5,xx	
;	Color 255,255,0:Text 380,y*9+530,xx,False ,False 	
	Next
	
	For y=0 To 4
	For x=0 To 4
	PokeInt sort1,x*5,PeekInt(in3,100*5+5*(y*5+x))
	Next
        sortrow()
	For x=0 To 4
	PokeInt infacts4,5*(y*5+x),PeekByte (sort1,5*x)
	Next
	ttt = Int(""+ PeekByte (sort1,0*5) +""+PeekByte (sort1,1*5) +""+PeekByte (sort1,2*5)+""+PeekByte (sort1,3*5)+""+PeekByte (sort1,4*5))
	xx = encode(ttt*5)
	PokeInt infactz4,100+y*5,xx	
;	Color 255,255,0:Text 210,y*9+470,xx,False ,False 	
	Next
End Function

Function getfacts3()
	For y=0 To 4
	For x=0 To 4
	PokeInt sort1,x*5,PeekInt(in2,5*(y*5+x))
	Next
        sortrow()
	For x=0 To 4
	PokeInt facts4,5*(y*5+x),PeekByte (sort1,5*x)
	Next
	ttt = Int(""+ PeekByte (sort1,0*5) +""+PeekByte (sort1,1*5) +""+PeekByte (sort1,2*5)+""+PeekByte (sort1,3*5)+""+PeekByte (sort1,4*5))
	xx = encode(ttt*5)
	PokeInt factz4,y*5,xx	
	Color 255,255,0:Text 60,y*9+210,xx,False ,False 	
	Next
	
	For y=0 To 4
	For x=0 To 4
	PokeInt sort1,x*5,PeekInt(in2,25*5+5*(y*5+x))
	Next
        sortrow()
	For x=0 To 4
	PokeInt facts4,5*(y*5+x),PeekByte (sort1,5*x)
	Next
	ttt = Int(""+ PeekByte (sort1,0*5) +""+PeekByte (sort1,1*5) +""+PeekByte (sort1,2*5)+""+PeekByte (sort1,3*5)+""+PeekByte (sort1,4*5))
	xx = encode(ttt*5)
	PokeInt factz4,25+y*5,xx	
	Color 255,255,0:Text 380,y*9+210,xx,False ,False 	
	Next

	
	For y=0 To 4
	For x=0 To 4
	PokeInt sort1,x*5,PeekInt(in2,50*5+5*(y*5+x))
	Next
        sortrow()
	For x=0 To 4
	PokeInt facts4,5*(y*5+x),PeekByte (sort1,5*x)
	Next
	ttt = Int(""+ PeekByte (sort1,0*5) +""+PeekByte (sort1,1*5) +""+PeekByte (sort1,2*5)+""+PeekByte (sort1,3*5)+""+PeekByte (sort1,4*5))
	xx = encode(ttt*5)
	PokeInt factz4,50+y*5,xx	
	Color 255,255,0:Text 60,y*9+330,xx,False ,False 	
	Next
	
	For y=0 To 4
	For x=0 To 4
	PokeInt sort1,x*5,PeekInt(in2,75*5+5*(y*5+x))
	Next
        sortrow()
	For x=0 To 4
	PokeInt facts4,5*(y*5+x),PeekByte (sort1,5*x)
	Next
	ttt = Int(""+ PeekByte (sort1,0*5) +""+PeekByte (sort1,1*5) +""+PeekByte (sort1,2*5)+""+PeekByte (sort1,3*5)+""+PeekByte (sort1,4*5))
	xx = encode(ttt*5)
	PokeInt factz4,75+y*5,xx	
	Color 255,255,0:Text 380,y*9+330,xx,False ,False 	
	Next
	
	For y=0 To 4
	For x=0 To 4
	PokeInt sort1,x*5,PeekInt(in2,100*5+5*(y*5+x))
	Next
        sortrow()
	For x=0 To 4
	PokeInt facts4,5*(y*5+x),PeekByte (sort1,5*x)
	Next
	ttt = Int(""+ PeekByte (sort1,0*5) +""+PeekByte (sort1,1*5) +""+PeekByte (sort1,2*5)+""+PeekByte (sort1,3*5)+""+PeekByte (sort1,4*5))
	xx = encode(ttt*5)
	PokeInt factz4,100+y*5,xx	
	Color 255,255,0:Text 210,y*9+270,xx,False ,False 	
	Next
End Function

Function mod1(x)
While x>255 
 x = x -256
Wend 
While  x<0 
 x = x +256
Wend 
Return x
End Function
Function mod2(x)
If x>65535 Then x = x -65536
;Wend 
If  x<0 Then x = x +65536
;Wend 
Return x
End Function

Function demorf2()
For y1=0 To 25
 PokeInt in2,625+y1*5,PeekInt (in2,y1*5)
Next

For y1=0 To 4
For i1=1 To 5 
For i=1 To 5
x = PeekInt (in2,(y1+1)*25*5+((i1-1)*5+i-1)*5)
x1 = Floor(x/255)
x2 = 65536-x1*255
x1 =mod1(x1 - z*z1); (x1 Xor z) And 255
x2 =mod1(x2 - z*z1);(x2 Xor z) And 255
x = x1*255+x2
 PokeInt in2,y1*25*5+((i1-1)*5+i-1)*5,x
	Next
	Next
Next
End Function

Function morf2()
For y1=0 To 25
 PokeInt in2,625+y1*5,PeekInt (in2,y1*5)
Next

For y1=0 To 4
For i1=1 To 5 
For i=1 To 5
x = PeekInt (in2,(y1+1)*25*5+((i1-1)*5+i-1)*5)
x1 = Floor(x/255)
x2 = 65536-x1*255
x1 =(x1 +z*10 ) Mod 255; (x1 Xor z) And 255
x2 =(x2+z*10 ) Mod 255;(x2 Xor z) And 255
x = x1*255+x2
 PokeInt in2,y1*25*5+((i1-1)*5+i-1)*5,x
	Next
	Next
Next
End Function

Function demorf1()
CopyBank in3,0,in9,0,20000
For ztl=1 To 120
CopyBank in9,0,in3,0,20000
For zt1=ztl To 1 Step -1
For y1=1 To 125
 x = PeekInt (in3,(y1-1)*5)
x1 = Int(Floor(x/256))
x2 = x-x1*256

x2 =mod1(x2+zt1+y1*10) ;(x2 Xor z) And 255
x1 =mod1(x1-zt1-y1*10); (x1 Xor z) And 255
x = x1*256+x2
 PokeInt in3,(y1-1)*5,x;mod2(x-z*100)

Next
Next
getin3()
getinfacts3()
getfacts3()
getnums2()

testinfacts(ztl)
Next
zzz1=zzz1+1
End Function

Function morf1()
For zt1=1 To ztx 
For y1=1 To 125
x = PeekInt (in2,(y1-1)*5)
x1 = Int(Floor(x/256))
x2 = x-x1*256
;x1 =mod1(x1 +zt*100 +zt1); (x1 Xor z) And 255
;x2 =mod1(x2  +zt1*100 +zt1);(x2 Xor z) And 255
x1 =mod1(x1 + zt1 +y1*10); (x1 Xor z) And 255
x2 =mod1(x2 -zt1-y1*10);(x2 Xor z) And 255
;x1 =mod1(x1 + 200*zt1); (x1 Xor z) And 255
;x2 =mod1(x2 + 200*zt1);(x2 Xor z) And 255
x = x1*256+x2
PokeInt in2,(y1-1)*5,x;mod2(x+z*100)
Next
Next
End Function

Function refactor()
aaa(51) = PeekByte (refactorfrom,0)+1
aaa(52) = PeekByte (refactorfrom,5)+1
aaa(53) = PeekByte (refactorfrom,10)+1
aaa(54) = PeekByte (refactorfrom,15)+1
aaa(55) = PeekByte (refactorfrom,20)+1
For i1=1 To 5 
For i=1 To 5
 bbb(i1,i)= PeekInt (in2,yy+((i1-1)*5+i-1)*5)
Next
Next

maxx = 0: i=1:i1=5
For y=1 To 5
For x=1 To 5
If maxx=<aaa(50+x) Then 
maxx = aaa(50+x):i=x+50
EndIf
Next
For x1=i-50 To i-50
For x=1 To 5
bbb(5+i1,5+x)=bbb(x1,x)
Next
Next
aaa(i1)=aaa(i)-1:i1=i1-1:aaa(i)=-1:maxx = 0


Next
	ttt$ = decode(refactorruleold*5)
	x1=Mid$(ttt$,1,1)
	x2=Mid$(ttt$,2,1)
	x3=Mid$(ttt$,3,1)
	x4=Mid$(ttt$,4,1)
	x5=Mid$(ttt$,5,1)
;		Color 255,255,0:Text x*60,y*9+600,ttt+ "    "+ refactorruleold +"  "+aaa(x1) + " " +aaa(x2) + " " +aaa(x3) + " " +aaa(x4) + " " +aaa(x5) + " "	,False ,False 	
	ttt$ = decode(refactorrule*5)
	x1=Mid$(ttt$,1,1)
	x2=Mid$(ttt$,2,1)
	x3=Mid$(ttt$,3,1)
	x4=Mid$(ttt$,4,1)
	x5=Mid$(ttt$,5,1)
	PokeByte  refactorto,0,aaa(x1)
	PokeByte refactorto,5,aaa(x2)
	PokeByte refactorto,10,aaa(x3)
	PokeByte refactorto,15,aaa(x4)
	PokeByte refactorto,20,aaa(x5)

	For x=1 To 5
	bbb(1,x)=bbb(5+x1,5+x)
	Next
	For x=1 To 5
	bbb(2,x)=bbb(5+x2,5+x)
	Next
	For x=1 To 5
	bbb(3,x)=bbb(5+x3,5+x)
	Next
	For x=1 To 5
	bbb(4,x)=bbb(5+x4,5+x)
	Next
	For x=1 To 5
	bbb(5,x)=bbb(5+x5,5+x)
	Next			
	
	For i1=1 To 5 
	For i=1 To 5
	 PokeInt in2,yy+((i1-1)*5+i-1)*5,bbb(i1,i)
	Next
	Next
;		Color 255,255,0:Text x*60,y*9+660,ttt+ "    "+ refactorrule + " " +aaa(x1) + " " +aaa(x2) + " " +aaa(x3) + " " +aaa(x4) + " " +aaa(x5) + " "	,False ,False 
		
End Function

Function modfacts()
	For y=0 To 4

	xx = (PeekByte (factz2,5*y) + z) Mod 120
	PokeByte modfacts1,y*5,xx
	Color 0,0,255:Text 120,y*9+270,xx,False ,False 	
	Next

	For y=0 To 4
	For x=0 To 4
	PokeByte modfacts2,y*25+x*5,PeekByte(factz,y*25+x*5)
	PokeByte refactorfrom,x*5,PeekByte(factz,y*25+x*5)	
	yy=y*25*5
	Next
	refactorrule = PeekByte(modfacts1,y*5)
	refactorruleold= PeekByte(factz2,y*5)	
	refactor()
	For x=0 To 4
	If y =0 dx=10:dy=10
	If y =1 dx=260:dy=10
	If y =2 dx=-110:dy=130
	If y =3 dx=140:dy=130			
	If y =4 dx=-90:dy=70	
	PokeInt modfacts2,y*25+x*5,PeekByte(refactorto,x*5)	
		Color 255,255,0:Text dx+y*60,dy+x*9+200,PeekByte(modfacts2,y*25+x*5)	,False ,False 	
;	Color 255,255,0:Text x*60,y*9+260,PeekByte(factz,x*25+y*5)	,False ,False 
	Next	
	Next
	

End Function

Function getfacts2()
	For y=0 To 4
	For x=0 To 4
	PokeInt sort1,x*5,PeekInt(factz,25*y+(x*5))
	Next
        sortrow()
	For x=0 To 4
	PokeInt facts2,5*(y*5+x),PeekByte (sort1,5*x)
	Next
	ttt = Int(""+ PeekByte (sort1,0*5) +""+PeekByte (sort1,1*5) +""+PeekByte (sort1,2*5)+""+PeekByte (sort1,3*5)+""+PeekByte (sort1,4*5))
	xx = encode(ttt*5)
	PokeInt factz2,y*5,xx	
	Color 0,0,255:Text 120,y*9+90,xx,False ,False 	
	Next

	For y=0 To 4
	PokeInt sort1,y*5,PeekInt(factz2,5*y)
	Next
        sortrow()
	For x=0 To 4
	PokeInt facts3,y*5,PeekByte (sort1,5*y)
	Next

	ttt = Int(""+ PeekByte (sort1,0*5) +""+PeekByte (sort1,1*5) +""+PeekByte (sort1,2*5)+""+PeekByte (sort1,3*5)+""+PeekByte (sort1,4*5))
	xx = encode(ttt*5)
	PokeInt factz3,y*5,xx:z=xx	
	Color 255,255,255:Text 90,y*9+63,xx,False ,False 	

	
End Function

Function getfacts()
	For y=0 To 4
	For x=0 To 4
	PokeInt sort1,x*5,PeekInt(in1,5*(y*5+x))
	Next
        sortrow()
	For x=0 To 4
	PokeInt facts,5*(y*5+x),PeekByte (sort1,5*x)
	Next
	ttt = Int(""+ PeekByte (sort1,0*5) +""+PeekByte (sort1,1*5) +""+PeekByte (sort1,2*5)+""+PeekByte (sort1,3*5)+""+PeekByte (sort1,4*5))
	xx = encode(ttt*5)
	PokeInt factz,y*5,xx	
	Color 255,255,0:Text 1,y*9+10,xx,False ,False 	
	Next
	
	For y=0 To 4
	For x=0 To 4
	PokeInt sort1,x*5,PeekInt(in1,25*5+5*(y*5+x))
	Next
        sortrow()
	For x=0 To 4
	PokeInt facts,5*(y*5+x),PeekByte (sort1,5*x)
	Next
	ttt = Int(""+ PeekByte (sort1,0*5) +""+PeekByte (sort1,1*5) +""+PeekByte (sort1,2*5)+""+PeekByte (sort1,3*5)+""+PeekByte (sort1,4*5))
	xx = encode(ttt*5)
	PokeInt factz,25+y*5,xx	
	Color 255,255,0:Text 320,y*9+10,xx,False ,False 	
	Next

	
	For y=0 To 4
	For x=0 To 4
	PokeInt sort1,x*5,PeekInt(in1,50*5+5*(y*5+x))
	Next
        sortrow()
	For x=0 To 4
	PokeInt facts,5*(y*5+x),PeekByte (sort1,5*x)
	Next
	ttt = Int(""+ PeekByte (sort1,0*5) +""+PeekByte (sort1,1*5) +""+PeekByte (sort1,2*5)+""+PeekByte (sort1,3*5)+""+PeekByte (sort1,4*5))
	xx = encode(ttt*5)
	PokeInt factz,50+y*5,xx	
	Color 255,255,0:Text 1,y*9+150,xx,False ,False 	
	Next
	
	For y=0 To 4
	For x=0 To 4
	PokeInt sort1,x*5,PeekInt(in1,75*5+5*(y*5+x))
	Next
        sortrow()
	For x=0 To 4
	PokeInt facts,5*(y*5+x),PeekByte (sort1,5*x)
	Next
	ttt = Int(""+ PeekByte (sort1,0*5) +""+PeekByte (sort1,1*5) +""+PeekByte (sort1,2*5)+""+PeekByte (sort1,3*5)+""+PeekByte (sort1,4*5))
	xx = encode(ttt*5)
	PokeInt factz,75+y*5,xx	
	Color 255,255,0:Text 320,y*9+150,xx,False ,False 	
	Next
	
	For y=0 To 4
	For x=0 To 4
	PokeInt sort1,x*5,PeekInt(in1,100*5+5*(y*5+x))
	Next
        sortrow()
	For x=0 To 4
	PokeInt facts,5*(y*5+x),PeekByte (sort1,5*x)
	Next
	ttt = Int(""+ PeekByte (sort1,0*5) +""+PeekByte (sort1,1*5) +""+PeekByte (sort1,2*5)+""+PeekByte (sort1,3*5)+""+PeekByte (sort1,4*5))
	xx = encode(ttt*5)
	PokeInt factz,100+y*5,xx	
	Color 255,255,0:Text 150,y*9+90,xx,False ,False 	
	Next
End Function

Function sortrow()

	For xt=0 To 4
		aaa(xt*5)=PeekInt (sort1,xt*5)+1
	Next
	For x=5 To 1 Step -1
	maxx =0
	For xt=0 To 4
	xx = aaa(xt*5):If maxx<xx Then maxx=xx:yy2=xt*5
	Next 
	aaa(yy2) =-10:PokeByte sort1,yy2,x
	Next
End Function 

Function errin3()
	For x=0 To 125
	If PeekInt(in1,x*5) <> PeekInt(in3,5*x) Then err(zzz1)=err(zzz1)+1
	Next			
	
End Function

Function getin3()
	For y=0 To 4
	For x=0 To 4
	If PeekInt(in1,5*(y*5+x)) <> PeekInt(in3,5*(y*5+x)) Then 
	Color 255,0,0 
	Else
	Color 0,255,0
	EndIf
	
	Text 30+x*60,400+y*9+10,PeekInt(in3,5*(y*5+x)),False ,False 
	Next
	Next
	For y=0 To 4
	For x=0 To 4
	If PeekInt(in1,5*(y*5+x+25))<> PeekInt(in3,5*(y*5+x+25)) Then
	Color 255,0,0 
	Else
	Color 0,255,0
	EndIf
	Text 350+x*60,400+y*9+10,PeekInt(in3,5*(y*5+x+25)),False ,False 
	Next
	Next
	For y=0 To 4
	For x=0 To 4
	If PeekInt(in1,5*(y*5+x+50)) <>   PeekInt(in3,5*(y*5+x+50)) Then 
	Color 255,0,0 
	Else 
	Color 0,255,0
	EndIf	
	Text 30+x*60,400+y*9+130,PeekInt(in3,5*(y*5+x+50)),False ,False 
	Next
	Next
	For y=0 To 4
	For x=0 To 4
	If PeekInt(in1,5*(y*5+x+75)) <> PeekInt(in3,5*(y*5+x+75)) Then
	Color 255,0,0 
	Else 
	Color 0,255,0
	EndIf		
	Text 350+x*60,400+y*9+130,PeekInt(in3,5*(y*5+x+75)),False ,False 
	Next
	Next
	For y=0 To 4
	For x=0 To 4
	If PeekInt(in1,5*(y*5+x+100)) <> PeekInt(in3,5*(y*5+x+100)) Then 
	Color 255,0,0 
	Else 
	Color 0,255,0
	EndIf		
	Text 180+x*60,400+y*9+70,PeekInt(in3,5*(y*5+x+100)),False ,False 
	Next
	Next				
	
End Function

Function getnums2()
	For y=0 To 4
	For x=0 To 4
	Color 0,255,0:Text 30+x*60,200+y*9+10,PeekInt(in2,5*(y*5+x)),False ,False 
	Next
	Next
	For y=0 To 4
	For x=0 To 4
	Color 0,255,0:Text 350+x*60,200+y*9+10,PeekInt(in2,5*(y*5+x+25)),False ,False 
	Next
	Next
	For y=0 To 4
	For x=0 To 4
	Color 0,255,0:Text 30+x*60,200+y*9+130,PeekInt(in2,5*(y*5+x+50)),False ,False 
	Next
	Next
	For y=0 To 4
	For x=0 To 4
	Color 0,255,0:Text 350+x*60,200+y*9+130,PeekInt(in2,5*(y*5+x+75)),False ,False 
	Next
	Next
	For y=0 To 4
	For x=0 To 4
	Color 0,255,0:Text 180+x*60,200+y*9+70,PeekInt(in2,5*(y*5+x+100)),False ,False 
	Next
	Next				
	
End Function

Function getnums()
	For y=0 To 4
	For x=0 To 4
	Color 0,255,0:Text 30+x*60,y*9+10,PeekInt(in1,5*(y*5+x)),False ,False 
	Next
	Next
	For y=0 To 4
	For x=0 To 4
	Color 0,255,0:Text 350+x*60,y*9+10,PeekInt(in1,5*(y*5+x+25)),False ,False 
	Next
	Next
	For y=0 To 4
	For x=0 To 4
	Color 0,255,0:Text 30+x*60,y*9+150,PeekInt(in1,5*(y*5+x+50)),False ,False 
	Next
	Next
	For y=0 To 4
	For x=0 To 4
	Color 0,255,0:Text 350+x*60,y*9+150,PeekInt(in1,5*(y*5+x+75)),False ,False 
	Next
	Next
	For y=0 To 4
	For x=0 To 4
	Color 0,255,0:Text 180+x*60,y*9+90,PeekInt(in1,5*(y*5+x+100)),False ,False 
	Next
	Next			
getfacts()
getfacts2()	
End Function
Function randnum()
For i = 0 To 125 
t = Rand(0,65535):PokeInt in1,i*5, t:PokeInt in2,i*5, t
Next 
End Function

Function decodet()
y=1
For x1=1 To 5
For x2=1 To 5
For x3=1 To 5
For x4=1 To 5
For x5=1 To 5
If((x1 <> x2) And (x1<>x3) And (x1<>x4) And (x1<>x5) And (x2<>x3) And (x2<>x4) And (x2<>x5) And (x3<>x4) And (x3<>x5) And (x4<>x5)) decode(y*5) =x1+""+x2+""+x3+""+x4+""+x5:encode(Int(x1+""+x2+""+x3+""+x4+""+x5)*5)=y:y=y+1
Next
Next
Next
Next
Next
End Function